using UnityEngine;

namespace BasicScript.Component
{
	public class BlinkObject : MonoBehaviour
	{
		private float time;

		private bool isBlink;

		private void Start()
		{
			time = ResetTime();
		}

		private void FixedUpdate()
		{
			if (isBlink)
			{
				time += Time.fixedDeltaTime;
				if (time < 0.2f)
				{
					base.transform.localScale = new Vector3(1f, (0.2f - time) / 0.2f, 1f);
					return;
				}
				if (time < 0.4f)
				{
					base.transform.localScale = new Vector3(1f, (0f - (0.2f - time)) / 0.2f, 1f);
					return;
				}
				base.transform.localScale = new Vector3(1f, 1f, 1f);
				isBlink = false;
				time = ResetTime();
			}
			else
			{
				time -= Time.fixedDeltaTime;
				if (time <= 0f)
				{
					time = 0f;
					isBlink = true;
				}
			}
		}

		private float ResetTime()
		{
			return Random.Range(3, 8);
		}
	}
}
